package com.zqh.cli.command;


import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.FileUtil;
//import com.zqh.cli.example.ASCIIArt;
import cn.hutool.core.util.StrUtil;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import java.io.File;
import java.nio.file.Paths;
import java.util.List;

@Command(name = "list",description = "查看文件列表",mixinStandardHelpOptions = true)
public class ListCommand implements Runnable {

    @Override
    public  void run() {
        // 整个路径的根目录
        String projectPath = System.getProperty("user.dir");
//        System.out.println(projectPath);
        // 整个目录的跟路径
        File parentPath = new File(projectPath);
        // 输入路径
        String inputPath = new File(parentPath,"/src/main/resources/templates/acm-template")
                .getAbsolutePath();
//        System.out.println(inputPath);
        List<File> files = FileUtil.loopFiles(inputPath);

        for (File file : files) {
            String strs = file.getAbsolutePath(); // 获取文件的绝对路径
            String str = FileUtil.getLastPathEle(file.toPath()) // 使用 file.toPath() 来获取 Path 对象
                    .getFileName()
                    .toString();
            System.out.println(str);
        }

    }

    public static void main(String[] args) {
        int exitCode = new CommandLine(new ListCommand()).execute(args);
        System.exit(exitCode);

    }

}
